{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Library Manager.ipynb\n",
    " \n",
    "The Library Manager Notebook collects the commands for managing the reference library.  The library is a local copy of records from https://potentials.nist.gov/. iprPy uses the [potentials](https://github.com/usnistgov/potentials) Python package to interact with these records, and as such, all settings and downloaded reference files are common for iprPy, potentials and atomman.\n",
    "\n",
    "The included tools in this Notebook allow for\n",
    "\n",
    "- Defining the library settings,\n",
    "- Downloading reference files from https://potentials.nist.gov/, and\n",
    "- Downloading additional reference records from [Materials Project](https://materialsproject.org/) and [OQMD](http://oqmd.org/)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "iprPy version 0.10.2\n"
     ]
    }
   ],
   "source": [
    "from pathlib import Path\n",
    "\n",
    "# https://github.com/usnistgov/iprPy\n",
    "import iprPy\n",
    "print('iprPy version', iprPy.__version__)\n",
    "\n",
    "settings = iprPy.Settings()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Basic library settings\n",
    "\n",
    "The iprPy.Settings class is a child of the potentials.Settings class and can be used to save user parameters for use with potentials, atomman, and iprPy.  All three packages share the same settings file as it is expected that there be only one local copy of the reference records from the potentials database.\n",
    "\n",
    "See the [potentials](https://github.com/usnistgov/potentials) Python package for more details."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.1. Settings directory\n",
    "\n",
    "By default, the settings __directory__ is placed in the user's home directory.  It can be useful to change this to share settings between\n",
    "\n",
    "- Tools that access the OS-defined \"HOME\" and platforms like Cygwin, MSYS2 that define their own \"home\" locations, and\n",
    "- Multiple users on the same hardware.  Note: read/write access to the files would have to be managed elsewhere."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Default settings directory: C:\\Users\\lmh1\\.NISTpotentials\n",
      "Current settings directory: C:\\Users\\lmh1\\.NISTpotentials\n"
     ]
    }
   ],
   "source": [
    "print('Default settings directory:', settings.defaultdirectory)\n",
    "print('Current settings directory:', settings.directory)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "#settings.set_directory(newpath)\n",
    "#print('Current settings directory:', settings.directory)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.2. Library directory\n",
    "\n",
    "The __library_directory__ is the local path to the location where the reference records are copied to.  By default, this is placed in the settings directory.  As the default settings directory is in a \".\" folder, it is highly suggested to change the library directory to somewhere more accessible if you wish to manually explore the records."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Current library directory: C:\\Users\\lmh1\\Documents\\library\n"
     ]
    }
   ],
   "source": [
    "print('Current library directory:', settings.library_directory)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "#settings.set_library_directory(newpath)\n",
    "#print('Current library directory:', settings.library_directory)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Download reference records from potentials.nist.gov\n",
    "\n",
    "Records from the potentials.nist.gov database can then be downloaded using the iprPy.Library class.  The class is a child of am.library.Database, which in turn is a child of potentials.Database giving it built-in tools for interacting with and exploring a variety of existing reference record styles."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create a Library object.  Currently requires log in information to access records, but settings will be changed soon..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Load library and sign in\n",
    "with open('E:/potentials_nist_gov/password.txt') as f:\n",
    "    user, pswd = f.read().strip().split()\n",
    "library = iprPy.Library(username=user, password=pswd)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The Library.download_refs() method will access records from potentials.nist.gov and download them to the local library.  Only records that have been added/changed will be saved.\n",
    "\n",
    "__NOTE__: Local records will be overwritten if a remote record with the same name and different content is found.  If you make changes to the local records that you would like to keep be sure to change the file's name to something unique.\n",
    "\n",
    "Parameters\n",
    "\n",
    "- __style__ (*str or list, optional*) The reference style(s) to download.  If not given, all reference style will be downloaded.\n",
    "- __status__ (*str, list or None, optional*) Only the potential_LAMMPS records with the given status(es) will be downloaded.  Allowed values are 'active' (default), 'superseded', and 'retracted'.  If set to None, all hosted potential_LAMMPS will be downloaded.\n",
    "- __format__ (*str, optional*) Indicates the file format to save the refs as: 'json' or 'xml'. Default is 'json'.\n",
    "- __indent__ (*int or None, optional*) If a number, then the saved content will be indented making it easier to read but larger files.  If None, the files will be compact.  Default value is 4.\n",
    "- __verbose__ (*bool, optional*) If True, informative messages will be printed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Found 19 of crystal_prototype\n",
      " - 19 duplicate records skipped\n",
      "Found 6 of dislocation\n",
      " - 6 duplicate records skipped\n",
      "Found 146 of free_surface\n",
      " - 146 duplicate records skipped\n",
      "Found 38 of point_defect\n",
      " - 38 duplicate records skipped\n",
      "Found 11 of stacking_fault\n",
      " - 11 duplicate records skipped\n",
      "332 LAMMPS potentials saved to localpath\n",
      " - 332 duplicate potentials skipped\n"
     ]
    }
   ],
   "source": [
    "# Specify the ref styles to download\n",
    "style = [\n",
    "    'crystal_prototype',\n",
    "    'dislocation',\n",
    "    'free_surface',\n",
    "    'point_defect',\n",
    "    'stacking_fault',\n",
    "    'potential_LAMMPS',\n",
    "]\n",
    "\n",
    "# Specify the potential_LAMMPS status(es) to download\n",
    "#status = 'active'  # Only the current versions\n",
    "status = None      # All records even old and retracted versions\n",
    "\n",
    "library.download_refs(style=style, status=status, verbose=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. Download DFT crystal structures\n",
    "\n",
    "The Library class also has methods for automatically downloading DFT crystal structures from Materials Project and OQMD into the local library. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.1. Define elements_set\n",
    "\n",
    "The methods explore records in the DFT databases based on lists of elements.  Some examples for the values:\n",
    "\n",
    "- ['Al'] will fetch only elemental Al structures\n",
    "- ['Al', 'Ni'] will fetch elemental Al and Ni structures and Al-Ni compounds."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Option #1: Auto generate\n",
    "\n",
    "This generates lists of elements based on the potentials in the database.  If potential_kwargs is blank, then all element combinations found in the potentials will be searched."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Specify the potential record style\n",
    "potential_record_style = 'potential_LAMMPS'\n",
    "\n",
    "# Specify any potential delimiters\n",
    "potential_kwargs = {}\n",
    "#potential_kwargs['id'] = '1986--Foiles-S-M--Ag--LAMMPS--ipr1'\n",
    "#potential_kwargs['pair_style'] = "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['Ag'],\n",
       " ['Ag', 'Au', 'Cu'],\n",
       " ['Ag', 'Au', 'Cu', 'Ni', 'Pd', 'Pt'],\n",
       " ['Ag', 'Cu'],\n",
       " ['Ag', 'H', 'Pd'],\n",
       " ['Ag', 'Ni'],\n",
       " ['Ag', 'O', 'Ta'],\n",
       " ['Al'],\n",
       " ['Al', 'Au', 'Si'],\n",
       " ['Al', 'Co'],\n",
       " ['Al', 'Co', 'Ni'],\n",
       " ['Al', 'Cu'],\n",
       " ['Al', 'Cu', 'Fe', 'Mg', 'Si'],\n",
       " ['Al', 'Cu', 'H'],\n",
       " ['Al', 'Fe'],\n",
       " ['Al', 'H', 'Ni'],\n",
       " ['Al', 'Mg'],\n",
       " ['Al', 'Mg', 'Zn'],\n",
       " ['Al', 'Mn', 'Pd'],\n",
       " ['Al', 'Nb', 'Ti'],\n",
       " ['Al', 'Ni'],\n",
       " ['Al', 'Ni', 'O'],\n",
       " ['Al', 'O'],\n",
       " ['Al', 'Pb'],\n",
       " ['Al', 'Sm'],\n",
       " ['Al', 'Ti'],\n",
       " ['Al', 'U'],\n",
       " ['As', 'Ga'],\n",
       " ['Au'],\n",
       " ['Au', 'Pt'],\n",
       " ['Au', 'Rh'],\n",
       " ['Au', 'Si'],\n",
       " ['B', 'C', 'N'],\n",
       " ['B', 'N'],\n",
       " ['Be'],\n",
       " ['Be', 'O'],\n",
       " ['Br', 'Cl', 'Cs', 'F', 'I', 'K', 'Li', 'Na', 'Rb'],\n",
       " ['C'],\n",
       " ['C', 'Cu'],\n",
       " ['C', 'Fe'],\n",
       " ['C', 'Fe', 'Mn', 'Si'],\n",
       " ['C', 'Fe', 'Ti'],\n",
       " ['C', 'H'],\n",
       " ['C', 'H', 'O'],\n",
       " ['C', 'Si'],\n",
       " ['Cd', 'Hg', 'S', 'Se', 'Te', 'Zn'],\n",
       " ['Cd', 'Se', 'Te'],\n",
       " ['Cd', 'Te'],\n",
       " ['Cd', 'Te', 'Zn'],\n",
       " ['Ce', 'O'],\n",
       " ['Co'],\n",
       " ['Co', 'Cr', 'Cu', 'Fe', 'Ni'],\n",
       " ['Co', 'Ni'],\n",
       " ['Cr'],\n",
       " ['Cr', 'Fe'],\n",
       " ['Cr', 'Fe', 'Ni'],\n",
       " ['Cr', 'Fe', 'W'],\n",
       " ['Cr', 'Ni'],\n",
       " ['Cs'],\n",
       " ['Cu'],\n",
       " ['Cu', 'Fe', 'Ni'],\n",
       " ['Cu', 'H'],\n",
       " ['Cu', 'Ni'],\n",
       " ['Cu', 'Pb'],\n",
       " ['Cu', 'Ta'],\n",
       " ['Cu', 'Zr'],\n",
       " ['Fe'],\n",
       " ['Fe', 'Ni'],\n",
       " ['Fe', 'O'],\n",
       " ['Fe', 'P'],\n",
       " ['Fe', 'V'],\n",
       " ['Fe', 'W'],\n",
       " ['Ga', 'In', 'N'],\n",
       " ['Ga', 'N'],\n",
       " ['Ge'],\n",
       " ['Ge', 'Si'],\n",
       " ['H', 'He', 'W'],\n",
       " ['H', 'Mg'],\n",
       " ['H', 'Pd'],\n",
       " ['He', 'Ta'],\n",
       " ['In', 'P'],\n",
       " ['K'],\n",
       " ['Li'],\n",
       " ['Li', 'S'],\n",
       " ['Mg'],\n",
       " ['Mo'],\n",
       " ['Mo', 'U'],\n",
       " ['Mo', 'U', 'Xe'],\n",
       " ['N', 'U'],\n",
       " ['Na'],\n",
       " ['Nb'],\n",
       " ['Nb', 'Ni'],\n",
       " ['Nb', 'Zr'],\n",
       " ['Ni'],\n",
       " ['Ni', 'Pd'],\n",
       " ['Ni', 'Ti'],\n",
       " ['Ni', 'Ti', 'V'],\n",
       " ['Ni', 'Zr'],\n",
       " ['O', 'Si'],\n",
       " ['O', 'Ti'],\n",
       " ['Pb'],\n",
       " ['Pb', 'Sn'],\n",
       " ['Pd'],\n",
       " ['Pt'],\n",
       " ['Rb'],\n",
       " ['Re', 'W'],\n",
       " ['Ru'],\n",
       " ['Si'],\n",
       " ['Sn'],\n",
       " ['Ta'],\n",
       " ['Ta', 'W'],\n",
       " ['Tb'],\n",
       " ['Ti'],\n",
       " ['U'],\n",
       " ['V'],\n",
       " ['W'],\n",
       " ['Zr'],\n",
       " ['mW'],\n",
       " ['meta_TWIP']]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "elements_set = set()\n",
    "for potential in library.get_lammps_potentials(**potential_kwargs):\n",
    "    elements_set.add(' '.join(sorted(potential.elements())))\n",
    "\n",
    "elements_lists = []\n",
    "for e in sorted(list(elements_set)):\n",
    "    elements_lists.append(e.split())\n",
    "elements_lists"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Option #2: Manually define"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#elements_lists = []\n",
    "#elements_lists.append(['Fe'])\n",
    "#elements_lists.append(['Cu'])\n",
    "#elements_lists.append(['Ni'])\n",
    "#elements_lists.append(['Cu', 'Ni'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.2. Fetch Materials Project reference structures\n",
    "\n",
    "Accessing Materials Project requires an API key.  Here, the API key used is read in from an external file."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ag\n",
      "Ag-Au-Cu\n",
      "Ag-Au-Cu-Ni-Pd-Pt\n",
      "Ag-Cu\n",
      "Ag-H-Pd\n",
      "Ag-Ni\n",
      "Ag-O-Ta\n",
      "Added mvc-388\n",
      "Added mvc-13894\n",
      "Al\n",
      "Al-Au-Si\n",
      "Al-Co\n",
      "Al-Co-Ni\n",
      "Al-Cu\n",
      "Al-Cu-Fe-Mg-Si\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "8a4f40380bef40718deb0f6ff1767158",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(IntProgress(value=0, max=659), HTML(value='')))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Al-Cu-H\n",
      "Al-Fe\n",
      "Al-H-Ni\n",
      "Al-Mg\n",
      "Al-Mg-Zn\n",
      "Al-Mn-Pd\n",
      "Al-Nb-Ti\n",
      "Al-Ni\n",
      "Al-Ni-O\n",
      "Added mvc-11155\n",
      "Added mvc-11911\n",
      "Added mvc-12893\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\lmh1\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\pymatgen\\io\\cif.py:1116: UserWarning: Issues encountered while parsing CIF: Some fractional co-ordinates rounded to ideal values to avoid issues with finite precision.\n",
      "  warnings.warn(\"Issues encountered while parsing CIF: %s\" % \"\\n\".join(self.warnings))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Added mvc-14043\n",
      "Added mvc-14277\n",
      "Added mvc-16800\n",
      "Added mvc-3776\n",
      "Added mvc-4622\n",
      "Added mvc-10289\n",
      "Added mvc-12050\n",
      "Added mvc-12901\n",
      "Added mvc-13696\n",
      "Added mvc-2316\n",
      "Added mvc-2602\n",
      "Added mvc-5627\n",
      "Added mvc-6477\n",
      "Added mvc-6822\n",
      "Added mvc-6929\n",
      "Added mvc-6939\n",
      "Added mvc-894\n",
      "Al-O\n",
      "Al-Pb\n",
      "Al-Sm\n",
      "Al-Ti\n",
      "Al-U\n",
      "As-Ga\n",
      "Au\n",
      "Au-Pt\n",
      "Au-Rh\n",
      "Au-Si\n",
      "B-C-N\n",
      "B-N\n",
      "Be\n",
      "Be-O\n",
      "Br-Cl-Cs-F-I-K-Li-Na-Rb\n",
      "C\n",
      "C-Cu\n",
      "C-Fe\n",
      "C-Fe-Mn-Si\n",
      "C-Fe-Ti\n",
      "C-H\n",
      "C-H-O\n",
      "C-Si\n",
      "Cd-Hg-S-Se-Te-Zn\n",
      "Cd-Se-Te\n",
      "Cd-Te\n",
      "Cd-Te-Zn\n",
      "Ce-O\n",
      "Co\n",
      "Co-Cr-Cu-Fe-Ni\n",
      "Co-Ni\n",
      "Cr\n",
      "Cr-Fe\n",
      "Cr-Fe-Ni\n",
      "Cr-Fe-W\n",
      "Cr-Ni\n",
      "Cs\n",
      "Cu\n",
      "Cu-Fe-Ni\n",
      "Cu-H\n",
      "Cu-Ni\n",
      "Cu-Pb\n",
      "Cu-Ta\n",
      "Cu-Zr\n",
      "Fe\n",
      "Fe-Ni\n",
      "Fe-O\n",
      "Added mvc-10966\n",
      "Added mvc-11541\n",
      "Added mvc-11993\n",
      "Added mvc-11999\n",
      "Added mvc-12005\n",
      "Added mvc-12039\n",
      "Added mvc-12063\n",
      "Added mvc-12125\n",
      "Added mvc-12204\n",
      "Added mvc-12205\n",
      "Added mvc-12905\n",
      "Added mvc-13181\n",
      "Added mvc-13234\n",
      "Added mvc-14925\n",
      "Added mvc-15135\n",
      "Added mvc-5967\n",
      "Fe-P\n",
      "Fe-V\n",
      "Fe-W\n",
      "Ga-In-N\n",
      "Ga-N\n",
      "Ge\n",
      "Ge-Si\n",
      "H-He-W\n",
      "H-Mg\n",
      "H-Pd\n",
      "He-Ta\n",
      "In-P\n",
      "K\n",
      "Li\n",
      "Li-S\n",
      "Mg\n",
      "Mo\n",
      "Mo-U\n",
      "Mo-U-Xe\n",
      "N-U\n",
      "Na\n",
      "Nb\n",
      "Nb-Ni\n",
      "Nb-Zr\n",
      "Ni\n",
      "Ni-Pd\n",
      "Ni-Ti\n",
      "Ni-Ti-V\n",
      "Ni-Zr\n",
      "O-Si\n",
      "O-Ti\n",
      "Added mvc-11423\n",
      "Added mvc-11600\n",
      "Added mvc-12404\n",
      "Added mvc-12466\n",
      "Added mvc-13391\n",
      "Added mvc-1923\n",
      "Added mvc-2169\n",
      "Added mvc-379\n",
      "Added mvc-4715\n",
      "Added mvc-5171\n",
      "Added mvc-9726\n",
      "Pb\n",
      "Pb-Sn\n",
      "Pd\n",
      "Pt\n",
      "Rb\n",
      "Re-W\n",
      "Ru\n",
      "Si\n",
      "Sn\n",
      "Ta\n",
      "Ta-W\n",
      "Tb\n",
      "Ti\n",
      "U\n",
      "V\n",
      "W\n",
      "Zr\n",
      "mW\n",
      "meta_TWIP\n"
     ]
    }
   ],
   "source": [
    "api_key_location = 'E:/Materials Project/API key.txt'\n",
    "with open(api_key_location) as f:\n",
    "    api_key = f.read()\n",
    "\n",
    "for elements in elements_lists:\n",
    "    print('-'.join(elements))\n",
    "    try:\n",
    "        library.download_mp_crystals(elements, api_key=api_key)\n",
    "    except:\n",
    "        print('Failed!')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.3. Fetch OQMD reference structures\n",
    "\n",
    "Accessing Materials Project requires an API key.  Here, the API key used is read in from an external file."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ag\n",
      "Ag-Au-Cu\n",
      "Failed!\n",
      "Ag-Au-Cu-Ni-Pd-Pt\n",
      "Failed!\n",
      "Ag-Cu\n",
      "Ag-H-Pd\n",
      "Failed!\n",
      "Ag-Ni\n",
      "Ag-O-Ta\n",
      "Failed!\n",
      "Al\n",
      "Al-Au-Si\n",
      "Failed!\n",
      "Al-Co\n",
      "Al-Co-Ni\n",
      "Failed!\n",
      "Al-Cu\n",
      "Al-Cu-Fe-Mg-Si\n",
      "Failed!\n",
      "Al-Cu-H\n",
      "Failed!\n",
      "Al-Fe\n",
      "Al-H-Ni\n",
      "Failed!\n",
      "Al-Mg\n",
      "Failed!\n",
      "Al-Mg-Zn\n",
      "Failed!\n",
      "Al-Mn-Pd\n",
      "Failed!\n",
      "Al-Nb-Ti\n",
      "Failed!\n",
      "Al-Ni\n",
      "Al-Ni-O\n",
      "Failed!\n",
      "Al-O\n",
      "Failed!\n",
      "Al-Pb\n",
      "Al-Sm\n",
      "Al-Ti\n",
      "Failed!\n",
      "Al-U\n",
      "As-Ga\n",
      "Au\n",
      "Au-Pt\n",
      "Au-Rh\n",
      "Au-Si\n",
      "B-C-N\n",
      "Failed!\n",
      "B-N\n",
      "Be\n",
      "Be-O\n",
      "Br-Cl-Cs-F-I-K-Li-Na-Rb\n",
      "C\n",
      "Failed!\n",
      "C-Cu\n",
      "Failed!\n",
      "C-Fe\n",
      "Failed!\n",
      "C-Fe-Mn-Si\n",
      "Failed!\n",
      "C-Fe-Ti\n",
      "Failed!\n",
      "C-H\n",
      "Failed!\n",
      "C-H-O\n",
      "Failed!\n",
      "C-Si\n",
      "Failed!\n",
      "Cd-Hg-S-Se-Te-Zn\n",
      "Failed!\n",
      "Cd-Se-Te\n",
      "Failed!\n",
      "Cd-Te\n",
      "Cd-Te-Zn\n",
      "Failed!\n",
      "Ce-O\n",
      "Failed!\n",
      "Co\n",
      "Co-Cr-Cu-Fe-Ni\n",
      "Failed!\n",
      "Co-Ni\n",
      "Cr\n",
      "Cr-Fe\n",
      "Cr-Fe-Ni\n",
      "Failed!\n",
      "Cr-Fe-W\n",
      "Failed!\n",
      "Cr-Ni\n",
      "Cs\n",
      "Cu\n",
      "Cu-Fe-Ni\n",
      "Failed!\n",
      "Cu-H\n",
      "Cu-Ni\n",
      "Cu-Pb\n",
      "Cu-Ta\n",
      "Cu-Zr\n",
      "Failed!\n",
      "Fe\n",
      "Fe-Ni\n",
      "Fe-O\n",
      "Failed!\n",
      "Fe-P\n",
      "Fe-V\n",
      "Fe-W\n",
      "Ga-In-N\n",
      "Failed!\n",
      "Ga-N\n",
      "Ge\n",
      "Ge-Si\n",
      "H-He-W\n",
      "H-Mg\n",
      "Failed!\n",
      "H-Pd\n",
      "He-Ta\n",
      "In-P\n",
      "K\n",
      "Li\n",
      "Li-S\n",
      "Mg\n",
      "Failed!\n",
      "Mo\n",
      "Mo-U\n",
      "Mo-U-Xe\n",
      "N-U\n",
      "Na\n",
      "Nb\n",
      "Nb-Ni\n",
      "Nb-Zr\n",
      "Failed!\n",
      "Ni\n",
      "Ni-Pd\n",
      "Ni-Ti\n",
      "Failed!\n",
      "Ni-Ti-V\n",
      "Failed!\n",
      "Ni-Zr\n",
      "Failed!\n",
      "O-Si\n",
      "Failed!\n",
      "O-Ti\n",
      "Failed!\n",
      "Pb\n",
      "Pb-Sn\n",
      "Pd\n",
      "Pt\n",
      "Rb\n",
      "Re-W\n",
      "Ru\n",
      "Si\n",
      "Sn\n",
      "Ta\n",
      "Ta-W\n",
      "Tb\n",
      "Ti\n",
      "Failed!\n",
      "U\n",
      "V\n",
      "W\n",
      "Zr\n",
      "Failed!\n",
      "mW\n",
      "meta_TWIP\n"
     ]
    }
   ],
   "source": [
    "for elements in elements_lists:\n",
    "    print('-'.join(elements))\n",
    "    try:\n",
    "        library.download_oqmd_crystals(elements)\n",
    "    except:\n",
    "        print('Failed!')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
